<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8" />
  <!--移动端的预览设置-->
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link href="../../static/images/favicon.ico" th:href="@{/images/me.png}" rel="icon" type="image/x-ico">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
  <link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}" />
  <title>友链管理</title>
</head>
<body>
    <!--导航-->
    <nav class="ui inverted gird-header m-opacity-tiny ">
      <div class="ui container">
        <div class="ui inverted secondary stackable menu">
          <h2 class="ui teal header item">后台管理</h2>
          <a href="#" th:href="@{/admin/blogs}" class=" m-item item m-mobile-hide"><i class="home icon"></i>文章管理</a>
          <a href="#" th:href="@{/admin/types}" class=" m-item item m-mobile-hide"><i class="clone outline icon"></i>分类管理</a>
          <a href="#" th:href="@{/admin/tags}" class=" m-item item m-mobile-hide"><i class="tags icon"></i>标签管理</a>
          <a href="#" th:href="@{/admin/friendlinks}" class="active  m-item item m-mobile-hide"><i class="pencil alternate icon"></i>友链管理</a>
          <a href="#" th:href="@{/admin/pictures}" class=" m-item item m-mobile-hide"><i class="image icon"></i>相册管理</a>
          <div class="right m-item m-mobile-hide menu">
            <div class="ui dropdown  item">
              <div class="text">
                <img class="ui avatar image" src="../../static/images/me.png" th:src="@{/images/me.png}">
                <span class="m-text-thin">Mr.ou</span>
              </div>
              <i class="dropdown icon"></i>
              <div class="menu">
                <a href="#" th:href="@{/admin/logout}" class="item">注销</a>
              </div>
            </div>
          </div>
        </div>
      </div>
      <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
        <i class="sidebar icon"></i>
      </a>
    </nav>

    <div class="m-padded-tb-hugex">
      <div class="ui  attached pointing menu">
        <div class="ui container">
          <div class="right menu">
            <a href="#" th:href="@{/admin/friendlinks/input}" class="item">发布</a>
            <a href="#" th:href="@{/admin/friendlinks}" class="teal active item">列表</a>
          </div>
        </div>
      </div>
    </div>

  <!--中间内容-->
    <div class="m-padded-tb-big ">
      <div class="ui container">
        <table class="ui compact teal table">
            <thead>
              <tr align="center">
                <th>ID</th>
                <th>博客名称</th>
                <th>博客地址</th>
                <th>图片地址</th>
                <th>添加时间</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              <tr align="center" th:each="friendlink,iterStat : ${pageInfo.list}">
                <td th:text="${iterStat.count}">1</td>
                <td th:text="${friendlink.blogname}">ONESTAR</td>
                <td th:text="${friendlink.blogaddress}">http://122.51.28.187:8080/</td>
                <td th:text="${friendlink.pictureaddress}">http://122.51.28.187:8080/</td>
                <td th:text="${#dates.format(friendlink.createTime,'yyyy-MM-dd HH:mm')}">2020-01-02 09:45</td>
                <!--th:text="${#dates.format(message.createTime,'yyyy-MM-dd HH:mm')}"-->
                <td>
                  <a href="#" th:href="@{/admin/friendlinks/{id}/input(id=${friendlink.id})}" class="ui mini teal basic button">编辑</a>
                  <a href="#" th:href="@{/admin/friendlinks/{id}/delete(id=${friendlink.id})}" onclick="return confirm('确定要删除该友链吗？三思啊! 删了可就没了！')" class="ui mini red basic button">删除</a>
                </td>
              </tr>
            </tbody>
            <tfoot>
              <tr>
                <th colspan="6" >
                  <div class="ui inverted divided stackable grid">
                    <div class="three wide column" align="center">
                      <a class="item ui mini basic button" th:href="@{/admin/friendlinks(pageNum=${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1)}" th:unless="${pageInfo.isFirstPage}">上一页</a>
                    </div>

                    <div class="ten wide column" align="center">
                      <p>第 <span th:text="${pageInfo.pageNum}"></span> 页，共 <span th:text="${pageInfo.pages}"></span> 页，有 <span th:text="${pageInfo.total}"></span> 个分类</p>
                    </div>

                    <div class="three wide column" align="center">
                      <a class="item ui mini basic button" th:href="@{/admin/friendlinks(pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages})}" th:unless="${pageInfo.isLastPage}">下一页</a>
                    </div>
                  </div>

                  <div align="center">
                    <a href="#" th:href="@{/admin/friendlinks/input}">
                      <button type="button" class="ui teal button m-mobile-wide m-margin-top"><i class="pencil icon"></i>新增</button>
                    </a>
                  </div>
                </th>
              </tr>
            </tfoot>
        </table>
        <!--消息提示-->
        <div class="ui success message" th:unless="${#strings.isEmpty(message)}">
          <i class="close icon"></i>
          <div class="" th:text="|提示： ${message}">提示：恭喜，操作成功！</div>
        </div>
      </div>
    </div>
    <br><br><br><br><br><br><br><br><br><br>

  <!--底部栏-->
    <footer class="ui inverted vertical segment m-padded-tb-massive m-opacity">
      <div class="ui center aligned container">
        <!--grid 将模块分为16份  divided分割线-->
        <div class="ui inverted divided stackable grid">

          <div class="four wide column">
            <div class="ui inverted link list">
              <h4 class="ui inverted header m-text-spaced m-opacity-mini">欢迎打赏(微信)</h4>
              <div class="item">
                <img src="../../static/images/weixin.png" th:src="@{/images/weixin.png}"  class="ui rounded image" alt="" style="width: 110px">
              </div>
            </div>
          </div>

          <div class="four wide column">
            <h4 class="ui inverted header m-text-spaced m-opacity-mini">其它博客地址</h4>
            <div class="ui inverted link list">
              <a href="#" class="item">掘金</a>
              <a href="#" class="item">CSDN</a>
              <a href="#" class="item">OSCHINA</a>
            </div>
          </div>

          <!--联系我-->
          <div class="four wide column">
            <h4 class="ui inverted header m-text-spaced m-opacity-mini">联系我</h4>
            <div class="ui inverted link list">
              <div href="#" class="item">QQ：1032423474</div>
              <div href="#" class="item">Email：itoldou@foxmail.com</div>
              <div href="#" class="item">Wechat：浪过、涛自在~</div>
            </div>
          </div>



          <div class="four wide column">
            <h4 class="ui inverted header m-text-spaced m-opacity-mini">Self-Introduce</h4>
            <p class="m-text-thin m-text-spaced m-opacity-mini">这是我的个人博客,我会在这里分享一些关于编程、写作、学习笔记、个人思考的相关内容，希望对来到这里的人有所帮助！</p>
          </div>

        </div>

        <!--最底部的线-->
        <div class="ui inverted section divider"></div>
        <div style="color: darkorange;margin-top: -18px" class="ui inverted m-text-thin m-text-spaced">Mr.ou's blog 已营业：<span id="htmer_time" class="item"></span>٩(๑òωó๑)۶</div>
        <p class="m-text-thin m-text-spaced m-opacity-tiny">Copyright @ 2020- 2020 OuJiangTao Designed by OuJiangTao</p>

      </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>

    <script>

        $('#blog-message').load(/*[[@{/footer/blogmessage}]]*/"/footer/blogmessage");

        $('.menu.toggle').click(function () {
          $('.m-item').toggleClass('m-mobile-hide');
        });

        $('.ui.dropdown').dropdown({
          on : 'hover'
        });
        //消息提示关闭初始化
        $('.message .close')
          .on('click', function () {
            $(this)
              .closest('.message')
              .transition('fade');
          });

        // 运行时间统计
        function secondToDate(second) {
          if (!second) {
            return 0;
          }
          var time = new Array(0, 0, 0, 0, 0);
          if (second >= 365 * 24 * 3600) {
            time[0] = parseInt(second / (365 * 24 * 3600));
            second %= 365 * 24 * 3600;
          }
          if (second >= 24 * 3600) {
            time[1] = parseInt(second / (24 * 3600));
            second %= 24 * 3600;
          }
          if (second >= 3600) {
            time[2] = parseInt(second / 3600);
            second %= 3600;
          }
          if (second >= 60) {
            time[3] = parseInt(second / 60);
            second %= 60;
          }
          if (second > 0) {
            time[4] = second;
          }
          return time;
        }
        function setTime() {
          /*此处为网站的创建时间     new Date(Date.UTC(year, month - 1, day, hour, minute, second))*/
          var create_time = Math.round(new Date(Date.UTC(2020, 06, 17, 15, 00, 15)).getTime() / 1000);
          var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
          currentTime = secondToDate((timestamp - create_time));
          currentTimeHtml = currentTime[0] + '年' + currentTime[1] + '天'
                  + currentTime[2] + '时' + currentTime[3] + '分' + currentTime[4]
                  + '秒';
          document.getElementById("htmer_time").innerHTML = currentTimeHtml;
        }
        setInterval(setTime, 1000);
    </script>
</body>
</html>